package org.neowei.image.commond;

import java.io.File;
import java.util.ArrayList;

public class CmdOption {
	private String cmd;
	private String srcpathWithFilename;
	private String desPathWithFilename;
	private String waterWithFilename = "";
	private String gmpath;
	private ArrayList<String> list = new ArrayList<String>();

	public CmdOption AddRow(String str, String args) {
		list.add(new StringBuffer(str).append(' ').append(args).toString());
		return this;
	}

	public String getGmpath() {
		return gmpath;
	}

	public void setGmpath(String gmpath) {
		this.gmpath = gmpath;
	}

	public String getCmd() {
		return cmd;
	}

	public void setCmd(String cmd) {
		this.cmd = cmd;
	}

	public String getSrcpathWithFilename() {
		return srcpathWithFilename;
	}

	public void setSrcpathWithFilename(String srcpathWithFilename) {
		this.srcpathWithFilename = srcpathWithFilename;
	}

	public String getDesPathWithFilename() {
		return desPathWithFilename;
	}

	public void setDesPathWithFilename(String desPathWithFilename) {
		this.desPathWithFilename = desPathWithFilename;
	}

	public String getWaterWithFilename() {
		return waterWithFilename;
	}

	public void setWaterWithFilename(String waterWithFilename) {
		this.waterWithFilename = waterWithFilename;
	}

	@Override
	public String toString() {
		StringBuffer result = new StringBuffer();
		if(gmpath !=null){
			result.append(gmpath).append(File.separatorChar);
		}
		result.append("gm").append(' ').append(cmd).append(' ');
		for (String str : list) {
			result.append(str).append(' ');
		}
		if (this.waterWithFilename.length() > 0) {
			result.append(waterWithFilename).append(' ');
		}
		result.append(srcpathWithFilename).append(' ');
		result.append(desPathWithFilename);
		return result.toString();
	}
}
